﻿//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Web;
//using System.Web.UI;
//using System.Web.UI.HtmlControls;
///// <summary>
///// Summary description for MyScriptManager
///// </summary>
//public static class MyScriptManager
//{
//    /// <summary>
//    /// Registers the client script include in the head section.  If the
//    /// same ID is sent, the source file is replaced with the new one.
//    /// </summary>
//    /// <param name="page">The page.</param>
//    /// <param name="id">The control ID to make sure there aren't two
//    /// registered under the same ID</param>
//    /// <param name="src">The file name.</param>
//    public static void RegisterHeadClientScriptInclude(Page page, string id, string src)
//    {
//        HtmlGenericControl si = null;
//        foreach (Control c in page.Header.Controls)
//        {
//            if (c.ID != id) continue;
//            si = (HtmlGenericControl)c;
//            break;
//        }
//        if (si == null)
//        {
//            si = new HtmlGenericControl { ID = id, TagName = "script" };
//            si.Attributes.Add("type", "text/javascript");
//            si.Attributes.Add("src", src);
//        }
//        else
//        {
//            si.Attributes["src"] = src;
//        }
//        page.Header.Controls.Add(si);
//    }

//    /// <summary>
//    /// Registers the client script code block in the head section of the page.
//    /// </summary>
//    /// <param name="page">The page.</param>
//    /// <param name="id">The id.</param>
//    /// <param name="code">The code.</param>
//    public static void RegisterHeadClientScriptBlock(this Page page, string id, string code)
//    {
//        HtmlGenericControl si = null;
//        foreach (Control c in page.Header.Controls)
//        {
//            if (c.ID != id) continue;
//            si = (HtmlGenericControl)c;
//            break;
//        }
//        if (si == null)
//        {
//            si = new HtmlGenericControl { ID = id, TagName = "script" };
//            si.Attributes.Add("type", "text/javascript");
//        }
//        si.InnerText = code;
//        page.Header.Controls.Add(si);
//    }
//}
